package edu.ynu.se.xiecheng.achitectureclass.demo.service;

import edu.ynu.se.xiecheng.achitectureclass.common.service.LogicService;
import edu.ynu.se.xiecheng.achitectureclass.demo.dao.DeviceDao;
import edu.ynu.se.xiecheng.achitectureclass.demo.entity.Device;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeviceService extends LogicService<DeviceDao, Device, Long> {
    public DeviceService(@Autowired DeviceDao dao) {
        super(dao);
    }

    public Device findDeviceBySerialNumber(String serialNumber) {
        return getDAO().findDeviceBySerialNumber(serialNumber);
    }
    public List<Device> findAllDevicesByType(String type) {
        return getDAO().findAllByTypeOrderByIdAsc(type);
    }
}